<?php include '../base/header.php' ?>
<?php
require_once '../sql/connection.php';
$commodity_id = $_GET['com_id'];
// 查询商品
$sql_config = "select * from commodity WHERE ID = $commodity_id";
// 连接数据库，并查询
$result_config = mysqli_query($GLOBALS['conn'], $sql_config);
// 获取商品信息
$row = mysqli_fetch_array($result_config);


?>


<div class="uk-card uk-card-default uk-card-body uk-width-auto uk-card-large uk-text-center">
    <h3 class="uk-card-title">结算（货到付款）</h3>
    <form class="uk-form-horizontal uk-margin-large" action="comfirm.php?com_id=<?php echo $row[0] ?>" method="post">

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">商品</label>
            <div class="uk-form-controls">
                <input class="uk-input" type="text" placeholder="<?php echo $row[1] ?>"
                       readonly="readonly">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">单价</label>
            <div class="uk-form-controls">
                <input class="uk-input" type="text" placeholder="<?php echo $row[3] ?>￥"
                       readonly="readonly">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">姓名</label>
            <div class="uk-form-controls">
                <input class="uk-input" name="username" id="username" type="text" placeholder="请输入收货人姓名">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">地址</label>
            <div class="uk-form-controls">
                <input class="uk-input" name="address" id="address" type="text" placeholder="请输入收货地址">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">电话号码</label>
            <div class="uk-form-controls">
                <input class="uk-input" name="telephone_number" id="telephone_number" type="text"
                       placeholder="输入收货人电话号码">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">邮编</label>
            <div class="uk-form-controls">
                <input class="uk-input" name="postcode" id="postcode" type="text" placeholder="请输入邮编">
            </div>
        </div>

        <div class="uk-margin">
            <label class="uk-form-label" for="form-horizontal-text">购买数量</label>
            <div class="uk-form-controls">
                <input class="uk-input" name="buy_number" id="buy_number" type="number"
                       placeholder="请输入要购买的数量，最大数量<?php echo $row[4] ?>">
            </div>
        </div>
        <input class="uk-button uk-button-primary" type="submit" name="submit" value="下单">
    </form>
</div>


<?php include '../base/footer.php' ?>
